body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background-color: #f4f4f4;
    transition: background-color 0.5s ease;
}

.container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    width: 80%;
    max-width: 800px;
}

.character-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.character-controls button {
    padding: 5px 10px;
    font-size: 14px;
    background-color: #eee;
    color: #333;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.character-controls button:hover {
    background-color: #ddd;
}

.input-section, .character-section, .output-section, .mode-section, .length-section, .location-section {
    margin-bottom: 20px;
}

.input-section label, .character-section label, .mode-section label, .length-section label, .location-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

input[type="text"], select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.characters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
    gap: 5px;
}

.characters label {
    font-weight: normal;
    display: flex;
    align-items: center;
    position: relative;
}

.characters input[type="checkbox"] {
    margin-right: 5px;
}

.villain-char {
    position: relative;
}

.villain-char:after {
    content: "⚠️";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.planet-char {
    position: relative;
}

.planet-char:after {
    content: "🪐";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.superhero-char:after {
    content: "⚡";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.female-char:after {
    content: "👩";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.twins-char:after {
    content: "👯";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.future-char:after {
    content: "🔮";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.ninja-char:after {
    content: "🥷";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.nightmare-char:after {
    content: "😱";
    position: absolute;
    top: 0;
    right: -24px;
    font-size: 12px;
}

.friend-char:after {
    content: "🤝";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

.bully-char:after {
    content: "😤";
    position: absolute;
    top: 0;
    right: -18px;
    font-size: 12px;
}

#generate-button {
    padding: 10px 20px;
    font-size: 18px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#generate-button:hover {
    background-color: #4cae4c;
}

#episode-summary {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 4px;
    background-color: #eee;
    min-height: 100px;
    white-space: pre-wrap;
    font-family: monospace;
    line-height: 1.5;
}

.loading-indicator {
    display: none;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: #5cb85c;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.audio-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

#toggleMusic {
    padding: 8px 15px;
    background-color: #4a90e2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#toggleMusic:hover {
    background-color: #357ab8;
}

.character-info-toggle {
    cursor: pointer;
    color: #4a90e2;
    text-decoration: underline;
    margin-bottom: 10px;
}

.character-descriptions {
    display: none;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    padding: 10px;
    border-radius: 4px;
    background-color: #f9f9f9;
    max-height: 200px;
    overflow-y: auto;
}

.character-descriptions ul {
    margin: 0;
    padding-left: 20px;
}

.character-descriptions li {
    margin-bottom: 5px;
}

body.nightmare-mode {
    background-color: #000;
    color: #fff;
}

body.nightmare-mode .container {
    background-color: #111;
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.3);
    border: 1px solid #333;
}

body.nightmare-mode #episode-summary {
    background-color: #222;
    border-color: #444;
    color: #ccc;
}

body.nightmare-mode #generate-button {
    background-color: #880000;
}

body.nightmare-mode #generate-button:hover {
    background-color: #aa0000;
}

body.mode-normal,
body.mode-spanish,
body.mode-russian {
    background-color: lightblue; 
}

body.mode-numberInvasion {
    background-color: steelblue; 
}

body.mode-lowercase {
    background-color: white; 
}

/* Start overlay that blocks the UI until Play is pressed */
.start-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.55);
    z-index: 9999;
}

.start-card {
    background: white;
    padding: 22px;
    border-radius: 10px;
    text-align: center;
    width: 80%;
    max-width: 360px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.start-card h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
}

.start-card p {
    margin: 0 0 14px 0;
    color: #444;
}

#playButton {
    padding: 10px 18px;
    background-color: #5cb85c;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
}

#playButton:hover {
    background-color: #4cae4c;
}

/* Dim the app while overlay is visible (just in case) */
body.overlay-active .container,
body.overlay-active .audio-controls {
    filter: blur(0.6px) saturate(0.9);
    pointer-events: none;
    user-select: none;
    opacity: 0.95;
}